<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'frontend.main.class.php');
$feObj = new FrontendMainBase();

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/video/video.class.php');
$mObj = new VideoBase();
$mObj->format = true;

//
if( $request_link_class == '' || $request_link_class == 'index' ) {
	$items = $mObj->getItems('', 0, false);
	$feObj->addInject('items', $items);
} else {
	$item = $mObj->getItem($request_link_class, 'link');
	if( $item['id'] > 0 ) {
		if( substr($item['file'], -4) == '.flv' ) {
			$item['file'] = substr($item['file'], 0, -4);
		} else {
			$item['file'] = '';
		}
		
		//
		$mObj->addViewed($item['id']);
		
		$feObj->addInject('mainpart', 'item');
		$feObj->addInject('item', $item);
	}
}

//
echo $feObj->display('pagelayout/pagelayout_main_video.tpl');
//
?>